const Mock = require("mockjs");
const { Random } = Mock;
const getQuestions = require("../../data/question");

module.exports = [
  // 获取问卷列表
  {
    path: "/api/question",
    method: "get",
    response(ctx) {
      const { url = "", query = {} } = ctx;
      const isStar = url.indexOf("isStar=true") >= 0;
      const isDeleted = url.indexOf("isDeleted=true") >= 0;
      const pageSize = parseInt(query.pageSize);
      return {
        code: 200,
        data: {
          list: getQuestions({ len: pageSize, isDeleted, isStar }),
          total: 100,
        },
      };
    },
  },
];
